package cn.exempale.mscapplication.model.db.dao;

import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Query;

import java.util.List;

import cn.exempale.mscapplication.model.db.entity.ResultEntity;
import cn.exempale.mscapplication.model.db.entity.TaskEntity;

@Dao
public interface TaskDAO extends BaseDAO<TaskEntity> {

    @Query("select * from task where deleted =:deleted order by crate_time desc")
    LiveData<List<TaskEntity>> findAll(int deleted);

//    @Query("select * from task where task_id = :taskId order by crate_time")
//    LiveData<TaskEntity> findByTaskId(String taskId);

    /**
     * 同步查询，需要异步执行
     *
     * @param taskId
     * @return
     */
    @Query("select * from task where task_id = :taskId")
    TaskEntity findByTaskId(String taskId);
}
